home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / Portable Patmos / usr / include / sys / signal.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-08  |  7.1 KB  |  210 lines  |  [TEXT/R*ch]

  1. /*
  2.  * Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  *
  33.  *    from: @(#)signal.h    7.16 (Berkeley) 3/17/91
  34.  *    $Id: signal.h,v 1.6 1993/09/19 18:56:21 brezak Exp $
  35.  */
  36.  
  37. #ifndef _SYS_SIGNAL_H_
  38. #define _SYS_SIGNAL_H_
  39.  
  40. #define NSIG    32        /* counting 0; could be 33 (mask is 1-32) */
  41.  
  42. #ifndef _POSIX_SOURCE
  43. #include <machine/trap.h>    /* codes for SIGILL, SIGFPE */
  44. #endif /* _POSIX_SOURCE */
  45.  
  46. #include <machine/signal.h>
  47.  
  48. #define    SIGHUP    1    /* hangup */
  49. #define    SIGINT    2    /* interrupt */
  50. #define    SIGQUIT    3    /* quit */
  51. #define    SIGILL    4    /* illegal instruction (not reset when caught) */
  52. #ifndef _POSIX_SOURCE
  53. #define    SIGTRAP    5    /* trace trap (not reset when caught) */
  54. #endif
  55. #define    SIGABRT    6    /* abort() */
  56. #ifndef _POSIX_SOURCE
  57. #define    SIGIOT    SIGABRT    /* compatibility */
  58. #define    SIGEMT    7    /* EMT instruction */
  59. #endif
  60. #define    SIGFPE    8    /* floating point exception */
  61. #define    SIGKILL    9    /* kill (cannot be caught or ignored) */
  62. #ifndef _POSIX_SOURCE
  63. #define    SIGBUS    10    /* bus error */
  64. #endif
  65. #define    SIGSEGV    11    /* segmentation violation */
  66. #ifndef _POSIX_SOURCE
  67. #define    SIGSYS    12    /* bad argument to system call */
  68. #endif
  69. #define    SIGPIPE    13    /* write on a pipe with no one to read it */
  70. #define    SIGALRM    14    /* alarm clock */
  71. #define    SIGTERM    15    /* software termination signal from kill */
  72. #ifndef _POSIX_SOURCE
  73. #define    SIGURG    16    /* urgent condition on IO channel */
  74. #endif
  75. #define    SIGSTOP    17    /* sendable stop signal not from tty */
  76. #define    SIGTSTP    18    /* stop signal from tty */
  77. #define    SIGCONT    19    /* continue a stopped process */
  78. #define    SIGCHLD    20    /* to parent on child stop or exit */
  79. #define    SIGTTIN    21    /* to readers pgrp upon background tty read */
  80. #define    SIGTTOU    22    /* like TTIN for output if (tp->t_local<OSTOP) */
  81. #ifndef _POSIX_SOURCE
  82. #define    SIGIO    23    /* input/output possible signal */
  83. #define    SIGXCPU    24    /* exceeded CPU time limit */
  84. #define    SIGXFSZ    25    /* exceeded file size limit */
  85. #define    SIGVTALRM 26    /* virtual time alarm */
  86. #define    SIGPROF    27    /* profiling time alarm */
  87. #define SIGWINCH 28    /* window size changes */
  88. #define SIGINFO    29    /* information request */
  89. #endif
  90. #define SIGUSR1 30    /* user defined signal 1 */
  91. #define SIGUSR2 31    /* user defined signal 2 */
  92.  
  93. #include <sys/cdefs.h>
  94.  
  95. #ifndef _POSIX_SOURCE
  96. typedef    void (*sig_t) __P((int));
  97. #endif
  98.  
  99. typedef void (*__sighandler_t) __P((int));
  100. typedef unsigned int sigset_t;
  101.  
  102. __BEGIN_DECLS
  103. int    sigaddset __P((sigset_t *, int));
  104. int    sigdelset __P((sigset_t *, int));
  105. int    sigemptyset __P((sigset_t *));
  106. int    sigfillset __P((sigset_t *));
  107. int    sigismember __P((const sigset_t *, int));
  108. __END_DECLS
  109.  
  110. #define sigemptyset(set)    ( *(set) = 0 )
  111. #define sigfillset(set)        ( *(set) = ~(sigset_t)0, 0 )
  112. #define sigaddset(set, signo)    ( *(set) |= 1 << ((signo) - 1), 0)
  113. #define sigdelset(set, signo)    ( *(set) &= ~(1 << ((signo) - 1)), 0)
  114. #define sigismember(set, signo)    ( (*(set) & (1 << ((signo) - 1))) != 0)
  115.  
  116. /*
  117.  * Signal vector "template" used in sigaction call.
  118.  */
  119. struct    sigaction {
  120.     __sighandler_t  sa_handler;     /* signal handler */
  121.     sigset_t sa_mask;        /* signal mask to apply */
  122.     int    sa_flags;        /* see signal options below */
  123. };
  124. #ifndef _POSIX_SOURCE
  125. #define SA_ONSTACK    0x0001    /* take signal on signal stack */
  126. #define SA_RESTART    0x0002    /* do not restart system on signal return */
  127. #endif
  128. #define SA_NOCLDSTOP    0x0004    /* do not generate SIGCHLD on child stop */
  129.  
  130. /*
  131.  * Flags for sigprocmask:
  132.  */
  133. #define    SIG_BLOCK    1    /* block specified signal set */
  134. #define    SIG_UNBLOCK    2    /* unblock specified signal set */
  135. #define    SIG_SETMASK    3    /* set specified signal set */
  136.  
  137. #ifndef _POSIX_SOURCE
  138. /*
  139.  * 4.3 compatibility:
  140.  * Signal vector "template" used in sigvec call.
  141.  */
  142. struct    sigvec {
  143.     void    (*sv_handler)();    /* signal handler */
  144.     int    sv_mask;        /* signal mask to apply */
  145.     int    sv_flags;        /* see signal options below */
  146. };
  147. #define SV_ONSTACK    SA_ONSTACK
  148. #define SV_INTERRUPT    SA_RESTART    /* same bit, opposite sense */
  149. #define sv_onstack sv_flags    /* isn't compatibility wonderful! */
  150.  
  151. /*
  152.  * Structure used in sigaltstack call.
  153.  */
  154. struct    sigaltstack {
  155.     char    *ss_base;        /* signal stack base */
  156.     int    ss_len;            /* signal stack length */
  157.     int    ss_onstack;        /* current status */
  158. };
  159.  
  160. /*
  161.  * Structure used in sigstack call.
  162.  */
  163. struct    sigstack {
  164.     char    *ss_sp;            /* signal stack pointer */
  165.     int    ss_onstack;        /* current status */
  166. };
  167.  
  168. /*
  169.  * Macro for converting signal number to a mask suitable for
  170.  * sigblock().
  171.  */
  172. #define sigmask(m)    (1 << ((m)-1))
  173.  
  174. #define    SIG_ERR        ((__sighandler_t) -1)
  175. #endif    /* _POSIX_SOURCE */
  176.   
  177. #define    SIG_DFL        ((__sighandler_t) 0)
  178. #define    SIG_IGN        ((__sighandler_t) 1)
  179.  
  180. #ifndef KERNEL
  181. #include <sys/types.h>
  182.  
  183. __BEGIN_DECLS
  184. /*void    (*signal __P((int, void (*) __P((int))))) __P((int));*/
  185. __sighandler_t signal __P((int, __sighandler_t));
  186. int    raise __P((int));
  187. #ifndef    _ANSI_SOURCE
  188. int    kill __P((pid_t, int));
  189. int    sigaction __P((int, const struct sigaction *, struct sigaction *));
  190. int    sigpending __P((sigset_t *));
  191. int    sigprocmask __P((int, const sigset_t *, sigset_t *));
  192. int    sigsuspend __P((const sigset_t *));
  193. #endif    /* !_ANSI_SOURCE */
  194. #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
  195. int    killpg __P((pid_t, int));
  196. void    psignal __P((unsigned, const char *));
  197. int    sigblock __P((int));
  198. int    siginterrupt __P((int, int));
  199. int    sigpause __P((int));
  200. int    sigreturn __P((struct sigcontext *));
  201. int    sigsetmask __P((int));
  202. int    sigstack __P((const struct sigstack *, struct sigstack *));
  203. int    sigvec __P((int, struct sigvec *, struct sigvec *));
  204. #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
  205. __END_DECLS
  206.  
  207. #endif    /* !KERNEL */
  208.  
  209. #endif /* !_SYS_SIGNAL_H_ */
  210.